iostream: Create properties on-demand instead of upfront.#15980
Merged
Conversation
slouken
approved these changes
Jul 13, 2026
Collaborator
|
It looks like this is crashing / failing automated tests, but conceptually seems fine. I don't think we need to go crazy with this in the general case though. Especially with the new hashtable implementation (that's still coming, right?), properties should be relatively inexpensive. |
It's possible that IOStreams might get created and thrown away a lot, perhaps at any point in an app's lifetime, so it makes sense to avoid doing the work of maintaining a properties group for each, if the app hasn't requested it, since this requires a bunch of allocations and locks. It's not necessarily worth doing this for other SDL objects, like SDL_Window, since there are likely to only be a few of them, and likely created at startup and living for the entire lifespan of the app. Fixes libsdl-org#14436.
icculus
force-pushed
the
sdl3-iostream-props-on-demand
branch
from
July 13, 2026 21:36
f68a91f to
9b24398
Compare
Collaborator
Author
Agreed. I kind of like the usage pattern of "a function pointer fires on creation to fill in current properties and never fires if we don't actually need it" but there's no way I'm going through and auditing the whole codebase to do this. :) 100% SDL_IOStream was the best candidate for this experiment and we'll call it done for now. |
Collaborator
Author
|
Fixed the bug that the tests caught. This can merge whenever! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It's possible that IOStreams might get created and thrown away a lot, perhaps at any point in an app's lifetime, so it makes sense to avoid doing the work of maintaining a properties group for each, if the app hasn't requested it, since this requires a bunch of allocations and locks.
It's not necessarily worth doing this for other SDL objects, like SDL_Window, since there are likely to only be a few of them, and likely created at startup and living for the entire lifespan of the app.
Fixes #14436.